var carousel_box = document.querySelector(".carousel_box"),
	carousel = document.querySelector("ul"),
	left_arrow = document.querySelector(".left_arrow"),
	right_arrow = document.querySelector(".right_arrow"),
	carousel_details = document.querySelectorAll("ul li"),
	now_index = 0,
	last_index = 0,
	is_run = false,
	timer,
	new_li,
	new_ol,
	controls,
	my_img,
	my_li,
	carousel_select = document.querySelector("select"),
	position_id = 3;

function request() {
	xhr = new XMLHttpRequest();
	xhr.open("POST", "http://build.bluej.cn/api/index/get_carousel"); //0
	xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xhr.send("position_id=" + position_id); //1
	xhr.addEventListener("readystatechange", function() { //2-4
		if(xhr.readyState == 4) {
			if(xhr.status == 200) {
				melon(JSON.parse(xhr.responseText));
			} else {
				alert("未知错误,直接问后台爸爸");
			}
		}
	})

}
request();

//根据下拉值进行改变
carousel_select.addEventListener("change", function() {
	carousel.innerHTML="";
	new_ol="";
	clearInterval(timer);
	position_id = this.value;
	//console.log(position_id);
	request();
})